<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<?php
session_start();
if ($_SESSION["member"] == null)
    header("location:../web/index.php");
?>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Home Social</title>
        <script language="javascript">
            function Checkform() {
                var password = document.getElementsByName("tbpassword_edit")[0].value;
                var email = document.getElementsByName("tbemail_edit")[0].value;
                if (password == "" || email == "") {
                    alert("fill username and password");
                    return false;
                }
                else {
                    return true;
                }
            }</script>
        <style>
            .body {
				font-family: "Arial Black", Gadget, sans-serif;
				font-size: 12px;
				font-style: normal;
				color: #000;	
            }
			.header {
				background-image:url(../web/img/panel.png);
				background-repeat:no-repeat;
				background-size:100%;
				max-height:400px;
				min-height:400px;
				height:400px;
			}

            .main_form {
                width: 800px;
                margin-right: auto;
                margin-left: auto;
                }
            .content {
                -webkit-background-clip: border-box;
				-webkit-background-origin: padding-box;
				-webkit-background-size: auto;
				-webkit-box-shadow: rgba(0, 0, 0, 0.0) 0px 1px 0px 0px;
				background-attachment: scroll;
				background-clip: border-box;
				background-color: rgba(0, 0, 0, 0);
				background-image: -webkit-linear-gradient(top, rgb(255, 255, 255) 0px, rgb(221, 221, 221) 100%);
				background-origin: padding-box;
				background-size: auto;
				border-bottom-color: rgb(204, 204, 204);
				border-bottom-left-radius: 4px;
				border-bottom-right-radius: 4px;
				border-bottom-style: solid;
				border-bottom-width: 1px;
				border-left-color: rgb(238, 238, 238);
				border-left-style: solid;
				border-left-width: 1px;
				border-right-color: rgb(238, 238, 238);
				border-right-style: solid;
				border-right-width: 1px;
				border-top-left-radius: 4px;
				border-top-right-radius: 4px;
				box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 0px 0px;
				color: rgb(51, 51, 51);
				font-family: 'Helvetica Neue', Arial, sans-serif;
				font-size: 14px;
				line-height: 18px;
				width: 400px;
				margin-left:auto;
				margin-right:auto;
				margin-top:30px;
				padding-top:10px;
				padding-left:100px;
            }
			.div_line {
				background-color:#30F;
				width:600px;
				height:35px;
				margin-top:30px;
				margin-left:100px;
				padding-top:5px;
				padding-left:20px;
				color:#FFF;
				font-size:22px;
				font-weight:bold;
			}
			.div_content {
				margin-left:100px;
				width:580px;
				padding:20px;
				background-color:#39F;
				margin-bottom:30px;
			}
			.button {
				background-color:#6C9;
				width:100px;
				height:30px;
				margin-left:30px;
				border:none;
				color:#FFF;
				font-size:16px;
				font-weight:bold;
			}
			.button:hover {
				background-color:#6C6;
			}
			.button:active {
				background-color:#6C9;
			}
            label{
                display: inline-block;
                width: 100px;
                height: 30px;
                padding: 4px;
            }
            input{
                padding: 4px;
            }
                .control_bar {
                width:800px;
                height:50px;
                margin-left: auto;
                margin-right: auto;
            }

            .button_control {
                -webkit-appearance: none;
				-webkit-border-image: none;
				-webkit-box-align: center;
				-webkit-box-shadow: rgb(255, 255, 255) 0px 1px 0px 0px;
				-webkit-writing-mode: horizontal-tb;
				background-color: rgb(1, 154, 210);
				background-image: linear-gradient(rgb(51, 188, 239), rgb(1, 154, 210));
				background-repeat: repeat-x;
				border-bottom-color: rgb(5, 126, 208);
				border-bottom-style: solid;
				border-bottom-width: 1px;
				border-collapse: collapse;
				border-left-color: rgb(5, 126, 208);
				border-left-style: solid;
				border-left-width: 1px;
				border-right-color: rgb(5, 126, 208);
				border-right-style: solid;
				border-right-width: 1px;
				border-top-color: rgb(5, 126, 208);
				border-top-style: solid;
				border-top-width: 1px;
				box-shadow: rgb(255, 255, 255) 0px 1px 0px 0px;
				box-sizing: border-box;
				cursor: pointer;
				display: block;
				float: right;
				font-family: 'Helvetica Neue', Arial, sans-serif;
				font-size: 13px;
				font-weight: bold;				
				letter-spacing: normal;
				line-height: 18px;
				padding-bottom: 5px;
				padding-left: 10px;
				padding-right: 10px;
				padding-top: 5px;
				position: relative;
				text-align: center;
				text-indent: 0px;
				text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 1px;
				text-transform: none;
				white-space: nowrap;
				width: 400px;
				height: 40px;
				word-spacing: 0px;
				writing-mode: lr-tb;				
            }
			.button_control a {
			color:#FFF;
			font-size:14px;
			text-decoration:none;
			}

            .button_control:hover {
                background-color: rgb(8, 128, 172);
				background-image: linear-gradient(rgb(18, 161, 214), rgb(4, 119, 162));
            }

            .button_control:active {
                background-color: rgb(1, 154, 210);
				background-image: linear-gradient(rgb(51, 188, 239), rgb(1, 154, 210));
            }
			.button_submit {
			width:500px;
			color:#FFF;
			}
        </style>
    </head>
    <body class="body">
		<div class="header"></div>          
        <?php
        require_once '../dao/membersdao.php';
        $name = $_SESSION["Name"];
        $member = membersdao::GetMembersByID($name);
        	print"<div class='control_bar'>";
        	print"<button class='button_control'><a href='home.php'>Home</a></button>";
                print"<button class='button_control'><a href='../bus/logout.php'>Sign out</a></button>";
                print"</div>";
                print"<form name='mainform' class='main_form' action='../bus/editmembers.php' method='post' onsubmit='return Checkform();'/>";
	
		print"<div class='content'>";
        	print"<div><label for='tbemail_edit'>Email:</label>";
        	print"<input type='text' name='tbemail_edit' value='" . $member->getEmail() . "'/></div>";
        	print"<div><label for='tbpassword_edit'>Password:</label>";
        	print"<input type='password' name='tbpassword_edit'/></div>";
        	print"<div><label for='tbage_edit'>Age:</label>";
        	print"<input type='text' name='tbage_edit' value='".$member->getAge()."'/></div>";
        	print"<div><label for='tbgender_edit'>Gender:</label>";
        	print "<select name='tbgender_edit' id='tbgender_edit'>";
			if($member->getGender())
			{
				print "<option value='1'>Male</option>";
				print "<option value='0' >Female</option>";
			}
			else{
				print "<option value='0'>Female</option>";
				print "<option value='1' >Male</option>";
			}
        	print "</select></div>";
        	print "<div><label for='tbstatus_edit'>Status:</label>";
        	print "<select name='tbstatus_edit'>";
			switch ($member->getStatus()) {
				case 0:
					print "<option value='0'>Single</option>";
					print "<option value='1'>Married</option>";
					print "<option value='2'>Relationship</option>";
					break;
				case 1:
					print "<option value='1'>Married</option>";
					print "<option value='0' >Single</option>";
					print "<option value='2'>Relationship</option>";
					break;
				case 2:
					print "<option value='2' >Relationship</option>";
					print "<option value='0' >Single</option>";
					print "<option value='1' >Married</option>";
					break;
				default:
					break;
			}              
			print "</select></div>";
			print"<div><label for='tblocation_edit'>Location:</label>";
			print"<input type='text' name='tblocation_edit' value='".$member->getLocation()."'/></div>";
			print"<input type='submit' value='Submit' class='button_control button_submit'/>";
		print"</div>";
        print"</form>";
        ?>
    </body>
</html>
